const loaderUtils = require('loader-utils');

module.exports = function (content) {
    // lib-flexible
    let {enable, target} = loaderUtils.getOptions(this);
    if ('string' == typeof target && target && enable) {
        // 目标文件才有的添加
        if (this.resourcePath.includes(target)) {
            // let flexible =  require.resolve('lib-flexible').replace(/\\/, '/');
            content = `import 'lib-flexible'; ${content}`;
        }
    }
    return content;
};
